package internal

import (
	"context"

	fpyDcsDb "gf/fpy/dcs/db"
)

func init() {
	fpyDcsDb.SetSoPath("./fpy/dcs/db/.so/db.so")
	fpyDcsDb.SetDbUrl("http://192.168.8.101:11001")
	fpyDcsDb.SetDbSid("0ao6")
}

type CmsModuleFieldDao struct {
	sid 	string
	dbSid   string
	projectSid 	string
	table   string
	group   string
	columns TCmsModuleFieldColumns
}

type TCmsModuleFieldColumns struct {
    Sid    string
    AddTime    string
    UpdateTime    string
    IsDel    string
    ModuleSid    string
    FieldName    string
    FieldNameCn    string
    FieldType    string
    FieldSetup    string
    IsSmall    string
    OpenState    string
    Sort    string
    FieldLine    string
    FieldNum    string
    IsTitle    string
}


var cCmsModuleFieldColumns = TCmsModuleFieldColumns{
    Sid:    "sid",
    AddTime:    "add_time",
    UpdateTime:    "update_time",
    IsDel:    "is_del",
    ModuleSid:    "module_sid",
    FieldName:    "field_name",
    FieldNameCn:    "field_name_cn",
    FieldType:    "field_type",
    FieldSetup:    "field_setup",
    IsSmall:    "is_small",
    OpenState:    "open_state",
    Sort:    "sort",
    FieldLine:    "field_line",
    FieldNum:    "field_num",
    IsTitle:    "is_title",
}

func NewCmsModuleFieldDao() *CmsModuleFieldDao {
	return &CmsModuleFieldDao{
		sid: 	"0apg",
		dbSid:	"0ao6",
		projectSid:	"dbd3",
		group:   "cms",
		table:   "module_field",
		columns: cCmsModuleFieldColumns,
	}
}

func (dao *CmsModuleFieldDao) Columns() TCmsModuleFieldColumns {
	return dao.columns
}

func (dao *CmsModuleFieldDao) Group() string {
	return dao.group
}

func (dao *CmsModuleFieldDao) Table() string {
	return dao.table
}

func (dao *CmsModuleFieldDao) Ctx(ctx context.Context) *fpyDcsDb.TDb {
	return fpyDcsDb.Ctx(ctx).Table(dao.sid).FpyProjectSid(dao.projectSid)
}